<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    div{
        width: 300px;
        height: 300px;
        border: 10px solid #ccc;
        background-color: tomato;
    }
</style>
<body>
    <div></div>

    <script>
        const div=document.querySelector('div');
        console.log(div.clientWidth,div.clientHeight);   //不包括边宽
        console.log(div.clientLeft,div.clientTop);          
    </script>
</body>
</html>